package com.shareach.dao.mongo;

import java.util.LinkedHashMap;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.mongodb.core.mapreduce.GroupByResults;
import org.springframework.data.mongodb.core.mapreduce.MapReduceResults;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;

import com.shareach.common.BaseQueryOrder;
import com.shareach.domain.BaseSiteDomain;

public interface BaseSiteDao {

	/**
	 * 
	 * @param dto
	 * @return
	 */
	public Long insert(BaseSiteDomain domain);

	/**
	 * 
	 * @return
	 */
	public void update(Criteria criteria, Update update);

	/**
	 * 
	 * @param conditionArgs
	 * @return
	 */
	public List<BaseSiteDomain> getLastNumberByCondition(LinkedHashMap<String, String> conditionArgs);

	public <T> MapReduceResults<T> groupMapReduce(Query query, String map, String reduce, Class<T> clas);

	/**
	 * 分组统计
	 * 
	 * @return
	 */
	public <T> GroupByResults<T> group(Criteria criteria, String key, String map, String reduce, Class<T> clas);

	/**
	 * 分组统计 多参
	 * 
	 * @return
	 */
	public <T> GroupByResults<T> groups(Criteria criteria, String map, String reduce, Class<T> clas, String... key);

	/**
	 * 按条件查�?
	 * 
	 * @return
	 */
	public List<BaseSiteDomain> findList(Criteria criteria);

	public List<BaseSiteDomain> findList(Query query);

	public BaseSiteDomain findOne(Query query);

	/**
	 * 按条件删除集�?
	 * 
	 * @return
	 */
	public <T> void delete(Query query, Class<T> clas);
	/**
	 * pageNum 第几页 pageSize 每页多少条  orders 排序 criterias 条件
	 * 
	 * @return
	 */
	public Page<BaseSiteDomain> getPageResult(Query query,BaseQueryOrder order);
}
